package com.java.activemq_produce.config;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.stereotype.Component;
import javax.jms.Queue;

/**
 * @author Woo_home
 * @create 2020/5/22 16:04
 */

@Component
@EnableJms // 开启 JMS 的注解
public class ConfigBean {

    // 读取 application.yml 的值
    @Value("${myQueue}")
    private String myQueue;

    @Bean
    public Queue queue() {
        return new ActiveMQQueue(myQueue);
    }
}
